package com.woniu.user.controller;

import com.woniu.entity.Result;
import com.woniu.user.DTO.ArticlePublishDTO;
import com.woniu.user.service.IArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 文章表 前端控制器
 * </p>
 *
 * @author He
 * @since 2023-02-17
 */
@RestController
@RequestMapping("/article")
@Api(tags = "文章")
public class ArticleController {

    @Autowired
    private IArticleService articleService;

    @ApiOperation("文章发布")
    @PostMapping("/publish")
    public Result publish(ArticlePublishDTO articlePublishDTO,@RequestPart("multipartFiles") MultipartFile[] multipartFiles) {
        return articleService.publish(articlePublishDTO,multipartFiles);
    }

    @ApiOperation("查询全部文章")
    public Result getListArticle(){
        return articleService.getListArticle();
    }

}
